<?php
namespace Admin\Model;
use Admin\Model\BaseModel;
use Org\Nx\Page;
/**
 * 菜单操作model
 */
class SysProductModel extends BaseModel{
    public static function newSelf()
    {
        return new self();
    }
    public function getProduct()
    {
        $where['state']='ON';
        $res=$this->where($where)->select();
        foreach ($res as $k=>$v)
        {
            $data[$v['productid']]=$v;
        }
        return $data;
    }
    public function thislist($map)
    {
        $where['state']='ON';
        $count = $this->where($map)->where($where)->count();// 查询满足要求的总记录数 $map表示查询条件
        $Page = new Page($count);// 实例化分页类 传入总记录数
        $data['show'] = $Page->show();// 分页显示输出
        $data['list'] = $this->where($map)->where($where)->order('productID desc')->limit($Page->firstRow.','.$Page->listRows)->select(); // $Page->firstRow 起始条数 $Page->listRows 获取多少条
        foreach ($data['list'] as $k=>$v)
        {
            
        }
        return $data;
    }
    public function findModuleByModuleID($moduleID)
    {
        $where['state']='ON';
        $where['moduleID']=$moduleID;
        return $this->where($where)->find();
    }
}
